﻿using SMCL.Core.Utils.Types.Json;

namespace SMCL.Core.Utils.Types
{
    public class Versions
    {
        public Version Latest { get; private set; }
        public Version LatestSnapshot { get; private set; }
        public Version[] AllVersions { get; private set; }
        public Versions(VersionManifest versionManifest)
        {
            AllVersions = Array.ConvertAll(versionManifest.Versions, versionInfo => new Version(versionInfo));
            Latest = (from version in AllVersions where version.Name == versionManifest.Latest.Release select version).FirstOrDefault();
            LatestSnapshot = (from version in AllVersions where version.Name == versionManifest.Latest.Snapshot select version).FirstOrDefault();
        }
    }
}
